package _02Map集合的遍历1_键找值方式;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("三国演义","罗贯中");
        map.put("红楼梦","曹雪芹");
        //map.put("红楼梦","曹先生");//如果键相同，则值会被覆盖
        map.put("西游记","吴承恩");
        map.put("java","高斯林");

        //map获取所有键
        Set<String> keySet = map.keySet();

        for (String s :keySet){
            System.out.println(s+"="+map.get(s));
        }

    }
}
